package com.lake.banner.uitls;

import android.os.Environment;
import android.util.Log;

import java.io.File;

public class Constants {
    public static final String DEFAULT_DOWNLOAD_DIR = Environment.getExternalStorageDirectory() + File.separator + "HBanner";

    //storage/emulated/0/Android/data/com.devices.touchscreen/files/Download/HBanner
    ///storage/emulated/0/HBanner/_cache/ae41a9a32717a0dfe37e8f1de1687106.jpg
///storage/emulated/0/HBanner/_cache/ba716e28637666464c3388427b3ffcef.jpg
///storage/emulated/0/HBanner/_cache/07d44258d76e18b42d4c4429e650a6f2.jpg
    public static String getFilePathByUrl(String urlStr, String cachePath) {
        if (!urlStr.contains("http"))
            return "";
        String type = urlStr.substring(urlStr.lastIndexOf("."));
        String cacheFilePath = MD5Util.md5(urlStr);
        String path = cachePath + File.separator + cacheFilePath + type;
        Log.i("Constants", "path: " + path);
        return path;
    }
}
